Skip to content

refactor: Moving tsup flags into config file and online logic to parent class, introducing @wdio/elements README#230

Merged
vishnuv688 merged 2 commits into
webdriverio:mainfrom
Winify:refactor/elements
Jun 17, 2026
Merged

refactor: Moving tsup flags into config file and online logic to parent class, introducing @wdio/elements README#230
vishnuv688 merged 2 commits into
webdriverio:mainfrom
Winify:refactor/elements

Conversation

@Winify

@Winify Winify commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

Three refactors to reduce duplication, plus packaging readiness for @wdio/elements:

  • onLine console-log accumulation moves into SessionCapturerBase. Three adapters had identical overrides; now the base class handles it.
  • inUiAutomatorScope computed once in getSuggestedLocators instead of independently in two helpers.
  • @wdio/elements gets a README, publishConfig, and "files" field for npm publishing. tsup flags extracted to tsup.config.ts.

Why

The onLine override in every adapter was pure copy-paste — each did createConsoleLogEntry + push + sendUpstream, identical to the base except the base was missing the push. Same story for inUiAutomatorScope: same inputs, same result, computed twice. This is the "if the same change would land in 2+ adapters, it belongs in core" rule from CLAUDE.md §3.

@wdio/elements is being published; it needs a README and correct packaging metadata.

How

  • SessionCapturerBase.onLine() already called createConsoleLogEntry and sendUpstream; it now also pushes to this.consoleLogs. Three adapter overrides deleted along with their now-unused imports (LogSource, LogLevel, createConsoleLogEntry).
  • inUiAutomatorScope is computed once at the getSuggestedLocators level and threaded into getSimpleSuggestedLocators / getComplexSuggestedLocators as a parameter.
  • trace-exporter.ts: buildTraceBundle reads the context title from the traced ContextOptionsEvent rather than re-deriving it from capabilities via resolveContextNaming.
  • .npmignore replaced by "files": ["dist", "README.md"] in package.json.

Architecture self-check

Required for every non-trivial PR. If a box is unchecked, explain why.

  • No new duplication. This PR does not add a type, constant, enum, or contract that already exists in another package. (If it consolidates one, note which item from CLAUDE.md §7 is being resolved.)
  • No cross-adapter imports. No code in service, nightwatch-devtools, or selenium-devtools imports from another adapter.
  • No adapter imports in backend / app. Neither package reaches into adapter internals.
  • Typed contracts at boundaries. Any new fetch(...), ws.send(...), or HTTP route has a typed request/response shape in shared (or in service types if shared doesn't exist yet, with a TODO to move).
  • No if (framework === '...') outside an adapter. Framework branching uses a typed FrameworkId.
  • No new any at package boundaries. Internal any is acceptable only at a documented framework-edge with a one-line comment.

Multi-adapter changes

  • This PR touches more than one adapter package.

If checked: why isn't this in core? Answer here:

It is. The onLine logic moved into core (SessionCapturerBase). The adapter changes are deletions of now-redundant overrides.


Debt scoreboard

List the CLAUDE.md §7 debt items this PR resolves, partially resolves, or extends. Delete this section only if the PR genuinely affects no debt items.

  • Resolved: <item, or "none">
  • Partially resolved: <item, or "none">
  • New debt introduced: <item, or "none — and explain why if any>

If new debt is introduced, it must be added to CLAUDE.md §7 in this PR.


Testing

  • Unit tests for new logic in shared / core (required per CLAUDE.md §4).
  • Regression test for any bug fix (required per CLAUDE.md §4).
  • pnpm build passes.
  • pnpm test passes.
  • pnpm lint passes.
  • For UI/runtime changes: verified in example/ (or example for the framework I changed).

If any required item is skipped, say so here with the reason:

<your note, or "n/a">


Screenshots / recordings (UI changes only)

@Winify Winify marked this pull request as ready for review June 16, 2026 15:10
@Winify Winify force-pushed the refactor/elements branch from f70cfa0 to a3b8228 Compare June 16, 2026 15:36
@Winify Winify requested a review from christian-bromann June 16, 2026 19:20
…pters

- Removing postbuild: pnpm pack
- Merging ROADMAP with SIMPLIFY_DEBT
@Winify Winify force-pushed the refactor/elements branch from a3b8228 to 0026281 Compare June 16, 2026 19:54
@vishnuv688 vishnuv688 merged commit 294c0a0 into webdriverio:main Jun 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants